import java.util.*;
public class Text {
    //新一期的笔试强训  day01

    public static void main(String[] args) {
        //第一题  ： 数字统计
        Scanner in = new Scanner(System.in);
        int L = in.nextInt();
        int R = in.nextInt();
        //统计个数
        int count = 0;
        for(int i = L; i <= R; i++) {
            int tmp = i;
            while(tmp > 0) {
                if(tmp % 10 == 2) {
                    count++;
                }
                tmp = tmp / 10;
            }
        }
        System.out.print(count);
    }
}
